﻿@using TomNet.IMSC.Model.DbModels.Common;
@using TomNet.Utility.Logging;
@{
    Layout = null;

    Dictionary<Menu, int> menu01 = ViewData["Menu01"] as Dictionary<Menu, int>;
    Dictionary<Menu, List<Menu>> menu02 = ViewData["Menu02"] as Dictionary<Menu, List<Menu>>;
    Dictionary<Menu, List<Menu>> menu03 = ViewData["Menu03"] as Dictionary<Menu, List<Menu>>;
    int nIndex = 2;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>信息管理系统 - 主页</title>
    <meta name="keywords" content="房源信息管理系统">
    <meta name="description" content="房源信息管理系统">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <link rel="shortcut icon" href="~/favicon.ico">
    <link href="~/Content/Css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="~/Content/Css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="~/Content/Css/animate.css" rel="stylesheet">
    <link href="~/Content/Css/style.css?v=4.1.0" rel="stylesheet">
</head>
<body id="bodycontent" class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
    <div id="wrapper">
        <!--左侧导航开始-->
        <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="nav-close">
                <i class="fa fa-times-circle"></i>
            </div>
            <div class="sidebar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="nav-header">
                        <div class="dropdown profile-element">
                            <span><img id="user_avatar" alt="image" class="img-circle" src="~/Content/Images/profile_small.jpg" /></span>
                            <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                <span class="clear">
                                    @*<span class="block m-t-xs"><strong class="font-bold">tommy</strong></span>*@
                                    <span class="text-muted text-xs block"> @( TomNet.Utility.Data.JsonHelper.FromJson<TomNet.IMSC.Model.ViewModels.LoginModel>(ViewBag.LoginModel).UserName) <b class="caret"></b></span>
                                </span>
                            </a>
                            <ul id="profile" class="dropdown-menu animated fadeInRight m-t-xs">
                                @*<li>
                                    <a class="J_menuItem" href="/User/AlterAvatar">修改头像</a>
                                </li>
                                <li>
                                    <a class="J_menuItem" href="/User/Profile">个人资料</a>
                                </li>
                                <li class="divider"></li>*@
                                <li>
                                    <a id="logout1" href="#">安全退出</a>
                                </li>
                            </ul>
                        </div>
                        <div class="logo-element">
                            IMSC
                        </div>
                    </li>

                    @*<li>
                        <a class="J_menuItem" href="/Menu" data-index="1">
                            <i class="fa fa-columns"></i>
                            <span class="nav-label">菜单管理</span>
                        </a>
                    </li>*@







                    <li style="display:none">
                        <a class="J_menuItem" href="/NewHouse/HouseType/Index">
                            <i class="fa fa-users"></i>
                            <span class="nav-label">户型列表</span>
                        </a>
                    </li>





                    @{
                        foreach (var item in menu01)
                        {
                            if (item.Value.Equals(1))//1级菜单
                            {
                                <li>
                                    <a class="J_menuItem" href="@item.Key.Url" data-index="@nIndex">
                                        <i class="fa fa-columns"></i>
                                        <span class="nav-label">@item.Key.Text</span>
                                    </a>
                                </li>
                            }
                            else if (item.Value.Equals(2))//2级菜单
                            {
                                <li class="">
                                    <a href="#">
                                        <i class="fa fa fa-bar-chart-o"></i> <span class="nav-label">@item.Key.Text</span>
                                        <span class="fa arrow"></span>
                                    </a>

                                    <ul class="nav nav-second-level">
                                        @{
                                            foreach (var item2 in menu02[item.Key])
                                            {
                                        <li>
                                            <a class="J_menuItem" href="@item2.Url" data-index="@nIndex">@item2.Text</a>
                                        </li>
                                            }
                                        }
                                    </ul>
                                </li>
                            }
                            else if (item.Value.Equals(3))//3级菜单
                            {
                                <li class="">
                                    <a href="#">
                                        <i class="fa fa-flask"></i>
                                        <span class="nav-label">@item.Key.Text</span><span class="fa arrow"></span>
                                    </a>

                                                    <ul class="nav nav-second-level">
                                                        @{
                                                            foreach (var item2 in menu02[item.Key])
                                                            {
                                                        <li>
                                                            <a href="#">@item2.Text<span class="fa arrow"></span></a>

                                                            <ul class="nav nav-third-level">
                                                                @{ //LogManager.GetLogger(GetType()).Error(item.Key);
                                                                    foreach (var item3 in menu03[item2])
                                                                    {
                                                                        <li>
                                                                            <a class="J_menuItem" href="@item3.Url" data-index="@nIndex">@item3.Text</a>
                                                                        </li>
                                                                            }
                                                                }
                                                            </ul>
                                                        </li>
                                                                            }
                                                        }

                                                    </ul>
                                                </li>}
                                                                        nIndex++;
                                                                    }

                    }
                </ul>
            </div>
        </nav>
        <!--左侧导航结束-->
        <!--右侧部分开始-->
        <div id="page-wrapper" class="gray-bg dashbard-1">
            <div class="row border-bottom">
                <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                    <div class="navbar-header">
                        <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
                        @*<form role="search" class="navbar-form-custom" method="post" action="search_results.html">
                                <div class="form-group">
                                    <input type="text" placeholder="请输入您需要查找的内容 …" class="form-control" name="top-search" id="top-search">
                                </div>
                            </form>*@
                    </div>
                    <ul class="nav navbar-top-links navbar-right">

                        <li class="dropdown">
                            <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#">
                                <i class="fa fa-bell"></i> <span class="label label-primary">8</span>
                            </a>
                            <ul class="dropdown-menu dropdown-alerts">
                                <li>
                                    <a href="mailbox.html">
                                        <div>
                                            <i class="fa fa-envelope fa-fw"></i> 您有16条未读消息
                                            <span class="pull-right text-muted small">4分钟前</span>
                                        </div>
                                    </a>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <a href="profile.html">
                                        <div>
                                            <i class="fa fa-qq fa-fw"></i> 3条新回复
                                            <span class="pull-right text-muted small">12分钟钱</span>
                                        </div>
                                    </a>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <div class="text-center link-block">
                                        <a class="J_menuItem" href="/Notifications/">
                                            <strong>查看所有 </strong>
                                            <i class="fa fa-angle-right"></i>
                                        </a>
                                    </div>
                                </li>
                            </ul>
                        </li>
                        <li class="hidden-xs">
                            <a id="adminfullscreen" data-index="0"><i class="fa fa-arrows-alt"></i> 全屏</a>
                        </li>
                        <li class="dropdown hidden-xs">
                            <a class="right-sidebar-toggle" aria-expanded="false">
                                <i class="fa fa-tasks"></i> 主题
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>
            <div class="row content-tabs">
                <button class="roll-nav roll-left J_tabLeft">
                    <i class="fa fa-backward"></i>
                </button>
                <nav class="page-tabs J_menuTabs">
                    <div class="page-tabs-content">
                        <a href="javascript:;" class="active J_menuTab" data-id="111111">首页</a>
                    </div>
                </nav>
                <button class="roll-nav roll-right J_tabRight">
                    <i class="fa fa-forward"></i>
                </button>
                <div class="btn-group roll-nav roll-right">
                    <button class="dropdown J_tabClose" data-toggle="dropdown">
                        关闭操作<span class="caret"></span>
                    </button>
                    <ul role="menu" class="dropdown-menu dropdown-menu-right">
                        <li class="J_tabShowActive">
                            <a>定位当前选项卡</a>
                        </li>
                        <li class="divider"></li>
                        <li class="J_tabCloseAll">
                            <a>关闭全部选项卡</a>
                        </li>
                        <li class="J_tabCloseOther">
                            <a>关闭其他选项卡</a>
                        </li>
                    </ul>
                </div>
                <a id="logout2" class="roll-nav roll-right J_tabExit logout"><i class="fa fa fa-sign-out"></i> 退出</a>
            </div>
            <div class="row J_mainContent" id="content-main">
                <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="/Default/Main" frameborder="0" data-id="111111" seamless></iframe>
            </div>
            <div class="footer">
                <div class="pull-right">
                    &copy; 2017-2018 <a href="http://www.baidu.com/" target="_blank">HIMS</a>
                </div>
            </div>
        </div>
        
        <!--右侧部分结束-->
        <!--右侧边栏开始-->
        <div id="right-sidebar">
            <div class="sidebar-container">
                <ul class="nav nav-tabs navs-3">
                    <li class="active">
                        <a data-toggle="tab" href="#tab-1">
                            <i class="fa fa-gear"></i> 主题
                        </a>
                    </li>
                </ul>
                <div class="tab-content">
                    <div id="tab-1" class="tab-pane active">
                        <div class="sidebar-title">
                            <h3> <i class="fa fa-comments-o"></i> 主题设置</h3>
                            <small><i class="fa fa-tim"></i> 你可以从这里选择和预览主题的布局和样式，这些设置会被保存在本地，下次打开的时候会直接应用这些设置。</small>
                        </div>
                        <div class="skin-setttings">
                            <div class="title">主题设置</div>
                            <div class="setings-item">
                                <span>收起左侧菜单</span>
                                <div class="switch">
                                    <div class="onoffswitch">
                                        <input type="checkbox" name="collapsemenu" class="onoffswitch-checkbox" id="collapsemenu">
                                        <label class="onoffswitch-label" for="collapsemenu">
                                            <span class="onoffswitch-inner"></span>
                                            <span class="onoffswitch-switch"></span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="setings-item">
                                <span>固定顶部</span>
                                <div class="switch">
                                    <div class="onoffswitch">
                                        <input type="checkbox" name="fixednavbar" class="onoffswitch-checkbox" id="fixednavbar">
                                        <label class="onoffswitch-label" for="fixednavbar">
                                            <span class="onoffswitch-inner"></span>
                                            <span class="onoffswitch-switch"></span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="setings-item">
                                <span>
                                    固定宽度
                                </span>
                                <div class="switch">
                                    <div class="onoffswitch">
                                        <input type="checkbox" name="boxedlayout" class="onoffswitch-checkbox" id="boxedlayout">
                                        <label class="onoffswitch-label" for="boxedlayout">
                                            <span class="onoffswitch-inner"></span>
                                            <span class="onoffswitch-switch"></span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="title">皮肤选择</div>
                            <div class="setings-item default-skin nb">
                                <span class="skin-name ">
                                    <a href="#" class="s-skin-0">
                                        默认皮肤
                                    </a>
                                </span>
                            </div>
                            <div class="setings-item blue-skin nb">
                                <span class="skin-name ">
                                    <a href="#" class="s-skin-1">
                                        蓝色主题
                                    </a>
                                </span>
                            </div>
                            <div class="setings-item yellow-skin nb">
                                <span class="skin-name ">
                                    <a href="#" class="s-skin-3">
                                        黄色/紫色主题
                                    </a>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--右侧边栏结束-->

    </div>
    <!-- 全局js -->
    <script type="text/javascript" src="~/Scripts/jquery.min.js?v=2.1.4"></script>
    <script type="text/javascript" src="~/Scripts/bootstrap.min.js?v=3.3.6"></script>
    <script type="text/javascript" src="~/Scripts/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script type="text/javascript" src="~/Scripts/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <script type="text/javascript" src="~/Scripts/plugins/layer/layer.min.js"></script>


    <!-- 自定义js -->
    <script type="text/javascript" src="~/Scripts/hplus.js?v=4.1.0"></script>
    <script type="text/javascript" src="~/Scripts/contabs.js?a=@(DateTime.Now.Millisecond)"></script>
    <!-- 第三方插件 -->
    <script type="text/javascript" src="~/Scripts/plugins/pace/pace.min.js"></script>
    <script type="text/javascript" src="~/Scripts/jquery.fullscreen.js"></script>
    <script>
         
        var OpenNewTab = function (url, par) { 
            var aList = $(".J_menuItem", window.parent.document);//
            for (var i = 0; i < aList.length; i++) {
                var href = $(aList[i]).attr("href"); 
                if (href.indexOf(url) >= 0) {
                    //console.info($(aList[i])); 
                    //$(aList[i]).attr("href", url +"?"+ par);
                    $(aList[i]).click(); 
                    $(".J_menuTab.active").dblclick();
                    break;
                }
            }
        }
    </script>


    <script>
        var storage = window.sessionStorage;
        storage.setItem('loginmodel', '@Html.Raw(ViewBag.LoginModel)');
        console.log($.parseJSON(storage.getItem('loginmodel')));
    </script>
    <script>
        function OpenTab(dataUrl,dataIndex, menuName) {
            // 获取标识数据
            //var dataUrl = $(this).attr('href'),
            //    dataIndex = $(this).data('index'),
            //    menuName = $.trim($(this).text())
            var flag = true;
            if (dataUrl == undefined || $.trim(dataUrl).length == 0) return false;

            // 选项卡菜单已存在
            $('.J_menuTab').each(function () {
                if ($(this).data('id') == dataUrl) {
                    if (!$(this).hasClass('active')) {
                        $(this).addClass('active').siblings('.J_menuTab').removeClass('active');
                        scrollToTab(this);
                        // 显示tab对应的内容区
                        $('.J_mainContent .J_iframe').each(function () {
                            if ($(this).data('id') == dataUrl) {
                                $(this).show().siblings('.J_iframe').hide();
                                return false;
                            }
                        });
                    }
                    flag = false;
                    return false;
                }
            });

            // 选项卡菜单不存在
            if (flag) {
                var str = '<a href="javascript:;" class="active J_menuTab" data-id="' + dataUrl + '">' + menuName + ' <i class="fa fa-times-circle"></i></a>';
                $('.J_menuTab').removeClass('active');

                // 添加选项卡对应的iframe
                var str1 = '<iframe class="J_iframe" name="iframe' + dataIndex + '" width="100%" height="100%" src="' + dataUrl + '" frameborder="0" data-id="' + dataUrl + '" seamless></iframe>';
                $('.J_mainContent').find('iframe.J_iframe').hide().parents('.J_mainContent').append(str1);

                //显示loading提示
                //            var loading = layer.load();
                //
                //            $('.J_mainContent iframe:visible').load(function () {
                //                //iframe加载完成后隐藏loading提示
                //                layer.close(loading);
                //            });
                // 添加选项卡
                $('.J_menuTabs .page-tabs-content').append(str);
                scrollToTab($('.J_menuTab.active'));
            }
            return false;
        }
    </script>
</body>
</html>
